﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutForEUI.cshtml";
}
<script src="~/Content/InsdepUI/plugin/echarts-4.0.2/echarts-4.0.2.min.js"></script>
<link href="~/Content/InsdepUI/plus/panel/statistic_standard_panel/style.css" rel="stylesheet" type="text/css">
<link href="~/Content/InsdepUI/iconfont/iconfont.css" rel="stylesheet" type="text/css">
<table style="width: 100%">
    <tr>
        <td style="width: 50%">
            <div class="easyui-panel" title="<b>@ViewBag.Text0</b>" style="width: 100%;height: 200px">
                <div style="padding: 10px">
                    <div class="statistic_standard_panel" style="width: 100%">
                        <ul>
                            <li style="width: 18%"><i class="iconfont color-olive"></i><span>@ViewBag.Text1</span><b id="b1"></b></li>
                            <li style="width: 18%"><i class="iconfont color-teal"></i><span>@ViewBag.Text2</span><b id="b2"></b></li>
                            <li style="width: 18%"><i class="iconfont color-teal"></i><span>@ViewBag.Text3</span><b id="b3"></b></li>
                            <li style="width: 18%"><i class="iconfont color-teal"></i><span>@ViewBag.Text4</span><b id="b4"></b></li>
                            <li style="width: 18%;"><i class="iconfont color-orange"></i><span>@ViewBag.Text5</span><b id="b5"></b></li>
                        </ul>
                    </div>
                </div>
            </div>
        </td>
        <td style="width: 50%">
            <div style="padding: 10px">
                <table id="dg" style="width: 98%;height: 200px" title="@ViewBag.Text6" class="easyui-datagrid" data-options="
                       rownumbers:true,
                       singleSelect:true,
                       autoRowHeight:false,
                       pagination:false,
                       fitColumns:true,
                       fit:false,
                       striped:true,
                       checkOnSelect:false,
                       selectOnCheck:false,
                       collapsible:false,
                       pageSize: 5,
                       pageList:[10,15,20]">
                    <thead>
                        <tr>
                            <th field="KFZT" formatter="formatKFZT">@ViewBag.Text7</th>
                            <th field="V04">@ViewBag.Text8</th>
                            <th field="DH">@ViewBag.Text9</th>
                            <th field="FTM">@ViewBag.Text10</th>
                            <th field="TM">@ViewBag.Text11</th>
                            <th field="SJJLRQ">@ViewBag.Text12</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </td>
    </tr>
</table>
<table style="width: 100%;padding-top: 15px">
    <tr>
        <td style="width: 50%">
            <table id="dg2" style="width: 100%;height: 200px" title="@ViewBag.Text15" class="easyui-datagrid" data-options="
                        rownumbers:true,
                        singleSelect:true,
                        autoRowHeight:false,
                        pagination:false,
                        fitColumns:true,
                        fit:false,
                        striped:true,
                        checkOnSelect:false,
                        selectOnCheck:false,
                        collapsible:false,
                        pageSize:5,
                        pageList:[10,15,20]">
                <thead>
                    <tr>
                        <th field="KFZT" formatter="formatKFZT">@ViewBag.Text7</th>
                        <th field="V04">@ViewBag.Text8</th>
                        <th field="DH">@ViewBag.Text9</th>
                        <th field="FTM">@ViewBag.Text10</th>
                        <th field="TM">@ViewBag.Text11</th>
                        <th field="D02">@ViewBag.Text13</th>
                    </tr>
                </thead>
            </table>
        </td>
        <td style="width: 50%">
            <div style="padding: 10px">
                <table id="dg3" style="width: 98%;height: 200px" title="@ViewBag.Text16" class="easyui-datagrid" data-options="
                        rownumbers:true,
                        singleSelect:true,
                        autoRowHeight:false,
                        pagination:false,
                        fitColumns:true,
                        fit:false,
                        striped:true,
                        checkOnSelect:false,
                        selectOnCheck:false,
                        collapsible:false,
                        pageSize:5,
                        pageList:[10,15,20]">
                    <thead>
                        <tr>
                            <th field="KFZT" formatter="formatKFZT">@ViewBag.Text7</th>
                            <th field="V04">@ViewBag.Text8</th>
                            <th field="DH">@ViewBag.Text9</th>
                            <th field="FTM">@ViewBag.Text10</th>
                            <th field="TM">@ViewBag.Text11</th>
                            <th field="D01">@ViewBag.Text14</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </td>
    </tr>
</table>
<br />
<table style="width: 100%">
    <tr>
        <td style="width: 99%">
            <div class="easyui-panel" title="<b>@ViewBag.Text17</b>" data-options="headerCls:'panel-bar-green panel-underline-blue'" style="width: 99%;">
                <div style="padding: 10px">
                    <div id="AdminWorkSpace_Index_ArchiveList" style="width:100%;height:200px"></div>
                </div>
            </div>
        </td>
    </tr>
</table>
<script>
    function formatKFZT(value, row) {
        if (value == "1")
            return "<span style='color:blue'>在库</span>";
        else if (value == "2")
            return "<span style='color:red'>等待出库</span>";
        else if (value == "3")
            return "<span style='color:red'>已出库</span>";
        else
            return "<span style='color:red'>已销毁</span>";
    }
    function formatDate(value, row) {
        if (value != null) {
            var time = new Date(parseInt(value.substr(6, 19)))//.toLocaleDateString();//13
            var month = (time.getMonth() + 1);
            if (month < 9)
                month = "0" + month;
            var day = time.getDate();
            if (day < 9)
                day = "0" + day;

            var hm = '';
            var hours = time.getHours(); var mint = time.getMinutes();
            if (hours == 0 && mint == 0)
                hm = '';
            else {
                if (hours < 9)
                    hours = "0" + hours;
                if (mint < 9)
                    mint = "0" + mint;

                hm = hours + ":" + mint;
            }


            return time.getFullYear() + "-" + month + "-" + day + " " + hm; ///+ ":" + time.getSeconds();
        }
        else {
            return "";
        }
    }

    $.ajax({
        url: '/AdminWorkSpace/Get_ajaxvArchivCount',
        type: 'post',
        dataType: 'text',
        success: function (data) {
            var str = data;
            var ayyay = str.split(',');
            $('#b1').text(ayyay[0]);
            $('#b2').text(ayyay[2]);
            $('#b3').text(ayyay[1]);
            $('#b4').text(ayyay[3]);
            $('#b5').text(ayyay[4]);
            //$('#b2').text(ayyay[1])
        }
    })


    //$.ajax({
    //    url: '/AdminWorkSpace/Get_ajaxvArchivStatus',
    //    type: 'post',
    //    dataType: 'text',
    //    success: function (data) {
    //        var str = data;
    //        var ayyay = str.split(',');
    //        //$('#b3').text(ayyay[1])
    //        //$('#b4').text(ayyay[2])
    //        $('#b5').text(ayyay[3])
    //        $('#b6').text(ayyay[4])
    //    }
    //});

    //$.ajax({
    //    url: '/AdminWorkSpace/Get_ajaxNoSQ',
    //    type: 'post',
    //    dataType: 'text',
    //    success: function (data) {
    //        var str = data;
    //        //var ayyay = str.split(',');
    //        $('#b3').text(str);
    //        //$('#b4').text(ayyay[2])
    //        //$('#b5').text(ayyay[3])
    //        //$('#b6').text(ayyay[4])
    //    }
    //});


    function SP()
    {
        window.location.href = "/Insiders/SPIndex?type=1"; 
    }
    $(function () {

        $('#dg').datagrid({
            url: '/AdminWorkSpace/Get_ajaxArchivApplicationList',
            type: 'post',
        })

        $('#dg2').datagrid({
            url: '/AdminWorkSpace/Get_ajaxArchivExpirationList',
            type: 'post',
        })

        $('#dg3').datagrid({
            url: '/AdminWorkSpace/Get_ajaxArchivOverdueList',
            type: 'post',
        })
    })
    $.ajax({
        url: '/AdminWorkSpace/Get_ajaxArchivlist',
        type: 'post',
        asyns: false,
        dataType: 'text',
        cache: false,
        success: function (data) {
            var str = data;
            var array = str.split('|');
            var arrayName = array[0].split(',');
            var arrayCount = array[1].split(',');
            ////基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('AdminWorkSpace_Index_ArchiveList'));

            //指定图表的配置项和数据
            var option = {
                title: {
                    x: 'center',
                    text: '库存分类图',
                },
                tooltip: {
                    trigger: 'item'
                },
                toolbox: {
                    show: true,
                    feature: {
                        dataView: { show: true, readOnly: false },
                        restore: { show: true },
                        saveAsImage: { show: true }
                    }
                },
                calculable: true,
                grid: {
                    borderWidth: 0,
                    y: 80,
                    y2: 60
                },
                xAxis: [
                    {
                        type: 'category',
                        show: false,
                        data: arrayName
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        show: false
                    }
                ],
                series: [
                    {
                        name: '档案数',
                        type: 'bar',
                        itemStyle: {
                            normal: {
                                color: function (params) {
                                    // build a color map as your need.
                                    var colorList = [
                                        '#C1232B', '#B5C334', '#FCCE10', '#E87C25', '#27727B',
                                        '#FE8463', '#9BCA63', '#FAD860', '#F3A43B', '#60C0DD',
                                        '#D7504B', '#C6E579', '#F4E001', '#F0805A', '#26C0C0'
                                    ];
                                    return colorList[params.dataIndex]
                                },
                                label: {
                                    show: true,
                                    position: 'top',
                                    formatter: '{b}\n{c}'
                                }
                            }
                        },
                        data: arrayCount,
                        markPoint: {
                            tooltip: {
                                trigger: 'item',
                                backgroundColor: 'rgba(0,0,0,0)',
                                formatter: function (params) {
                                    return '<img src="'
                                        + params.data.symbol.replace('image://', '')
                                        + '"/>';
                                }
                            }
                            
                        }
                    }
                ]
            };
            myChart.setOption(option);
        }
    })

   
</script>
